	function toggle(id) {
		var element = document.getElementById(id);
		if (element.style.display=="none") element.style.display="block";
		else  element.style.display="none";
	}	
	
	function getElementsByClass(searchClass,node,tag) {
		var classElements = new Array();
		if ( node == null )
			node = document;
		if ( tag == null )
			tag = '*';
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) {
				classElements[j] = els[i];
				j++;
			}
		}
		return classElements;
	}	

	function setDisplayStyleByClass(cssClass, display) {
		var elements = getElementsByClass(cssClass, null, "div");
		for (i = 0; i < elements.length; i++) {
			elements[i].style.display=display;
		}	
	}

	function expandAll() {
		setDisplayStyleByClass("test", "block"); // Expand all test nodes
		setDisplayStyleByClass("module", "block"); // Expand all module nodes
	}
	
	function showPassed() {
		setDisplayStyleByClass("test", "none"); // First hide all tests 
		setDisplayStyleByClass("test-passed", "block"); // Expand all passed-test nodes
		setDisplayStyleByClass("module", "block"); // Expand all module nodes
	}
	
	function showFailed() {
		setDisplayStyleByClass("test", "none"); // First hide all tests 
		setDisplayStyleByClass("test-failed", "block"); // Expand all failed-test nodes
		setDisplayStyleByClass("module", "block"); // Expand all module nodes
	}
	
	function collapseAll() {
		setDisplayStyleByClass("test", "block"); // Hide all test nodes
		setDisplayStyleByClass("module", "none"); // Expand all module nodes, for test nodes to be shown more easily 
	}
	